<template>
  <div class="details">
     <el-card>
        <div>{{ news.title }}</div>
        <div>{{ news.time }}</div>
        <div>
          <div v-html="news.content"></div>
        </div>
     </el-card>
  </div>
</template>

<script>
export default {
  name: 'newsDetails',
  data() {
    return {
      news: {}
    }
  },
  created() {
    let id = this.$route.query.id
    if (!id) return

    this.$request.get('/news/selectById/' + id).then(res => {
      const { code, data, msg } = res
      if (code == 200) {
        this.news = data
      } else {
        this.$message.error(msg)
      }
    })
  }
}
</script>

<style scope>
.details {
  padding: 10px;
}
</style>